var toyApp=angular.module('toyApp');
	toyApp.controller('shelvesCtl', [
	'$state',
	'$scope',
	'toyService',
	'broadcastBetweenCtrls',
	function($state,$scope,toyService,broadcastBetweenCtrls){
		$scope.querybackid='';
		$scope.$on('ADD_SHELVES_SUCCESS',function(){
			queryorderback();
		});
		$scope.toyshelves=function(backid){
			toyService('toysheleves',function(res){
				if(!res.success){
					 return false;
				}else{
					alert('物品上架成功!');
					$scope.$broadcast('ADD_SHELVES_SUCCESS');
				
				}},{
					backid:backid
				});
			};
			$scope.searchBybackId=function(){
				queryorderback();
			};
		 var queryorderback=function(){
		 	toyService('orderbacklist',function(res){
				if(!res.success){
					 return false;
				}
				else{
					$scope.orderbacklist=res.info;
				
				}},{
					backid:$scope.querybackid
				});
		};
		$scope.timeStamp=new Date().getTime();
		$scope.$watch('timeStamp',function(){
		queryorderback();
	});
	}]);